package com.burstly.lib.component;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import com.burstly.lib.network.beans.RequestData;
import com.burstly.lib.network.beans.ResponseBean;
import com.burstly.lib.network.beans.ResponseBean.ResponseData;
import com.burstly.lib.network.beans.ResponseBean.ResponseData.AdType;
import com.burstly.lib.util.Utils;

class DebugView extends View
{
  private final AdaptorController mController;
  private StringBuilder mDebugText;
  private int mDeltaRowOffset;
  private Paint mPaint;
  private int mParentHeight;
  private int mParentWidth;
  private int mRowOffset;

  DebugView(Context paramContext, AdaptorController paramAdaptorController)
  {
    super(paramContext);
    this.mController = paramAdaptorController;
    setWillNotDraw(false);
    this.mPaint = new Paint();
    this.mPaint.setColor(-16777216);
    this.mPaint.setStrokeWidth(3.0F);
    this.mPaint.setTextSize(40.0F);
    this.mRowOffset = ((int)Utils.scale(20));
    this.mDeltaRowOffset = ((int)Utils.scale(15));
    this.mDebugText = new StringBuilder();
  }

  private void processLine(Canvas paramCanvas, String paramString)
  {
    processLine(paramCanvas, paramString, false);
  }

  private void processLine(Canvas paramCanvas, String paramString, boolean paramBoolean)
  {
    if (paramBoolean)
      paramCanvas.drawText(paramString, 10.0F, this.mRowOffset, this.mPaint);
    this.mRowOffset += this.mDeltaRowOffset;
    this.mDebugText.append(paramString).append("\n");
  }

  protected void onDraw(Canvas paramCanvas)
  {
    super.onDraw(paramCanvas);
    paramCanvas.drawColor(-1);
    ResponseBean.ResponseData localResponseData = this.mController.getCurrentAdData();
    String str = String.valueOf(localResponseData.getCrid());
    this.mDebugText.setLength(0);
    processLine(paramCanvas, "network: " + this.mController.getNetworkName(), true);
    processLine(paramCanvas, "crid: " + str);
    processLine(paramCanvas, "Actual size (WxH): " + Utils.scaleToDip(Integer.valueOf(this.mParentWidth)) + "x" + Utils.scaleToDip(Integer.valueOf(this.mParentHeight)));
    ResponseBean localResponseBean = this.mController.getCurrentState().getFullResponse();
    processLine(paramCanvas, "Zone size (WxH): " + localResponseBean.getWidth() + "x" + localResponseBean.getHeight());
    ResponseBean.ResponseData.AdType localAdType = localResponseData.getAdType();
    if (localAdType != null)
    {
      processLine(paramCanvas, "AdType size (WxH): " + localAdType.getWidth() + "x" + localAdType.getHeight());
      processLine(paramCanvas, "ormma/mraid/rewards: " + Utils.isOrmma(localAdType) + "/" + Utils.isMraid(localAdType) + "/" + Utils.isRewards(localResponseData.getDataType()));
    }
    RequestData localRequestData = this.mController.getCurrentState().getRequestData();
    processLine(paramCanvas, "p/z: " + localRequestData.getPublisher() + "/" + localRequestData.getZone());
    this.mRowOffset = ((int)Utils.scale(20));
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    ViewGroup localViewGroup = (ViewGroup)getParent();
    if (localViewGroup != null)
    {
      this.mParentHeight = localViewGroup.getHeight();
      this.mParentWidth = localViewGroup.getWidth();
      setMeasuredDimension(this.mParentWidth, this.mParentHeight);
      return;
    }
    super.onMeasure(paramInt1, paramInt2);
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    return true;
  }

  public String toString()
  {
    return this.mDebugText.toString();
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.DebugView
 * JD-Core Version:    0.6.2
 */